<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class OtherOrderStatus extends Model
{
    use HasFactory;

    /**
     *允许批量赋值的字段
     */
    public $fillable = [
        'order_id',
        'change_mark',
    ];

    /**
     * 可搜索的字段
     */
    public $searchable = [
        'order_status',
        'operate_man',
        'shop_type',
    ];

    /**
     * 默认倒序
     */
    protected $defaultSortCriteria = ['id,desc'];

    /**
     * 操作类型枚举
     */
    public  $changeTypeEnum = [
        'pc' => 'pc',
        'wechatApplet' => '微信小程序',
        'app' => 'app',
    ];

    /**
     * 操作人枚举
     */
    public  $operateManEnum = [
        'system' => '系统',
        'user' => '用户',
        'Administrator' => '后台管理员',
    ];

    /**
     * 订单状态枚举
     */
    public  $orderStatusEnum = [
        'pendingPayment' => '待付款',
        'toBeShipped' => '待发货',
        'shipped' => '已发货',
        'completed' => '已完成',
        'closed' => '已关闭',
        'invalidOrder' => '无效订单',
    ];

    /**
     * 关联订单模型
     */

    public function order()
    {
        return $this->belongsTo(Order::class, 'order_id', 'id');
    }

}
